<table width="100%"><tr><td width="20%">
<a href="../index.html">&lt; index</a><br />
<a href="index.html">&lt; 2. Console</a><br />
<a href="console_drawing.html">&lt; 2.2 Drawing on the root console</a>
</td><td width="60%">
<p align="center">
=====================================<br />
Changing the fading parameters<br />
=====================================<br />
</p></td><td width="20%">
</td></tr></table>
<style type="text/css">
.code { color:#444444; background-color:#EEEEEE;}
pre { color:#444444; background-color:#EEEEEE;}
table.param td { border : 1px solid #000000; }
th { background-color: #44BBFF; color: #FFFFFF }
table.none td { border : 0 }
</style>
<p class="code"><pre>
C++ : static void TCODConsole::setFade(uint8 fade, const TCODColor &fadingColor)
C   : void TCOD_console_set_fade(uint8 fade, TCOD_color_t fadingColor)
Py  : console_set_fade(fade, fadingColor)
</pre></p>
This function defines the fading parameters, allowing to easily fade the game screen to/from a color. Once they are defined, the fading parameters are valid for ever. You don't have to call setFade for each rendered frame (unless you change the fading parameters).<br />
<table class="param">
<tr><th>Parameter</th><th>Description</th></tr>
<tr><td>fade</td><td>The fading amount. 0 =&gt; the screen is filled with the fading color. 255 =&gt; no fading effect.</td></tr>
<tr><td>fadingColor</td><td>The color to use during the console flushing operation.</td></tr>
</table>
Example :<br />
Fading the screen to black.<br />
<p class="code"><pre>
C++ : for (int fade=255; fade >= 0; fade --) {
          TCODConsole::setFade(fade,TCODColor::black);
          TCODConsole::flush();
      }
C   : int fade;
      for (fade=255; fade >= 0; fade --) {
          TCOD_console_setFade(fade,TCOD_black);
          TCOD_console_flush();
      }      
Py  : for fade in range(255,0) :
          libtcod.console_setFade(fade,libtcod.black)
          libtcod.console_flush()
</pre></p>
